#!/usr/bin/env perl

use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/../lib";

use DBDefs;
use aliased 'MusicBrainz::Server::DatabaseConnectionFactory' => 'Databases';
use MusicBrainz::Server::Constants qw( @FULL_TABLE_LIST );

my $conn = Databases->get_connection('SYSTEM_READWRITE');
my $sql = Sql->new($conn->conn);

for my $table (@FULL_TABLE_LIST) {
    my $real_table = $table;
    $real_table = 'editor' if $table eq 'editor_sanitised';
    $sql->auto_commit;
    $sql->do("SET search_path = musicbrainz; ALTER TABLE $real_table DISABLE TRIGGER ALL");
}
